<!doctype html>
<html>
		<head>
		<meta charset="utf-8">
		<title>讨论区详情</title>
		<?php echo $this->render('/_include/_header');?>
		<script type="text/javascript">
		var myScroll;
		var param = {};
        var page = 1;
		function loaded () {
			$(window).scroll(function(e) {
		
				if ($(document).scrollTop() >= $(document).height() - $(window).height()) {
					$('#pullUp').show();
					var h = $('#pullUp').outerHeight(true);
					$(document).scrollTop($(document).height() - $(window).height())
					
					setTimeout(function(){

					},500);
				}
			});
			get_data();
			
		}


    function get_data(refresh){
        if(refresh){
             page = 1;
        }
        param = {postid: <?php echo $_GET['id']?>, userid:1};
        getData({
			ajax_url: 'http://pvoice.chinamobo.com/function_php/api/index.php/community_post/index/view',
			lastpage_tips: true,
            div: '.data-list',
            data: param,
        },function(data){
			get_reply();
			//alert(JSON.stringify(data));
		});
    }
	    function get_reply(refresh){
        if(refresh){
             page = 1;
        }
        param = {};
        ScrollData({
   		    ajax_url: 'http://pvoice.chinamobo.com/function_php/api/index.php/community_reply',
		    lastpage_tips: true,
            div: '.reply-list',
            data: param,
        },function(data){
		});
    }

      function get_replies(refresh){
        if(refresh){
             page = 1;
        }
		
		var content = $('#reply_content').val();
		if ($.trim(content) == ''){
			Xalert('说点什么吧', 1500);
			return false;
		}

        param = {postid: <?php echo $_GET['id']?>,userid:0, content:content};
		$.ajax({
		cache: false,
		type: 'POST',
		url: 'http://pvoice.chinamobo.com/function_php/api/index.php/community_reply/index/create',
		dataType: 'JSON',
		//jsonp: "jsonpcallback",
		data: param,
		crossdomain: true,

		success: function(success) {
			
				 $('#reply_content').val("");  
				
			get_reply(true);
		    }
		});
       
    }
	
		</script>
		</head>
		<body class="bg-eeeeee">
<div id="absolute" class="ub">
          <div id="page">
    <div id="header">
              <div class="btn-return ub-img5 " onClick="goback();"></div>
              <h1>讨论区详情</h1>
            </div>
    <div id="wrapper2" style="bottom:0em; margin-top:3em; width:100%">
              <div id="scroller2">
              <ul>
        <div id="dataLoding" class="loading">
                  <p class="ub-pc ub"> <span></span>正在加载数据... </p>
                </div>
        <div class="postdetail  margin-body"  style="background-color:#fff; "> 
                  <!-- 帖子详情 -->
                  <div class="data-list uhide"> {{each list as v i}}
            <dl class=" uinn">
                      <div class="ub">
                <div class="margin-r-10" ><a href="#"><img src="http://pvoice.chinamobo.com/function_php/{{v.avatar}}" class="avatar avatar-30"></a></div>
                <div class="ub-f1">
                          <div class="index_111 ub"><a href="#" class="c-5ca31d ulev1">{{v.userid}}</a><span class="ub-f1 landlord ulev-1 c-747474">楼主</span></div>
                          <div class="ub ulev-1 title">
                    <div class="icon-title ub ulev-1  c-747474">
                              <div class="ub">
                        <div class="icon-time item"></div>
                        <span class="ub-f1">{{dateFormatDiff(v.addtime)}}</span> </div>
                              <div class="ub margin-l-10">
                        <div class="icon-news item"></div>
                        <span class="ub-f1">{{v.replys?v.replys:'0'}} </span> </div>
                            </div>
                  </div>
                        </div>
              </div>
                      <div class="margin-t-10c-747474 con-text"><span class="d-block">{{v.content}}</span> {{if v.images ==''}}{{else}}
                        <div class="post-img" style="background-image:url('http://pvoice.chinamobo.com/function_php/{{v.images}}')"></div>
                        {{/if}}</div>
                    </dl>
            {{/each}} </div>
                  <div class="detail_content">
            <div class="margin-b-20 ub ub-ver">
                      <div class="bor-t-e0e0e0 ">
                <div class="reply-list uhide"> {{each list as v i}}
                          <div id="reply-{{v.replyid}}" class="bor-b-e0e0e0 uinn">
                    <div class="icon-title">
                              <div class="ub detail-block">
                        <div><img src="http://pvoice.chinamobo.com/function_php/{{v.avatar}}" class="small-avatar"></div>
                        <span class="c-5ca31d margin-l-10">{{v.username}} </span> <span class="ulev-1 c-747474 ub-f1 landlord" >{{v.replyid}}楼</span> </div>
                              <p class="c-747474 margin-tb-05 ulev-1">{{v.content}}</p>
                              <div class="ub c-747474"><span class="ulev-2 ub-f1" style="display:block;">{{dateFormatDiff(v.addtime)}}</span>
                        <div class="icon-news itemBig"></div>
                      </div>
                            </div>
                  </div>
                          {{/each}} </div>
                <div class="reply-list"></div>
              </div>
                    </div>
          </div>
                </div>
        <div id="pullUp">
                  <div class="ub ub-pc">
            <div class="pullUpIcon ub-img4"></div>
            <div class="pullUpLabel">正在加载...</div>
          </div>
                </div>
        </div>
      </ul>
            </div>
  </div>
          <div class="footer-fixed">
    <footer>
              <div id="footer" class="fixed ub">
        <div class="footer-text uc-a1 ub-f1 bg-fff">
                  <input type="text" placeholder="说点什么吧..." id="reply_content">
                </div>
        <div class="footer-btn uc-a1 tx-middle t-wh" onClick="get_replies();">回复</div>
      </div>
            </footer>
  </div>
        </div>
</div>
<?php echo $this->render('/_include/_footer');?> 
<script>
$(function(){
	loaded();
    Dbug(1);
   	
});

</script>
</body>
</html>